<!--
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-05-22 14:32:05
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-07-04 15:12:26
 * @FilePath: \巡检管理系统\巡检任务详情
 *
-->
<script setup lang="ts">
import { PropType, reactive } from 'vue'
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
import { useDictStore } from '@/store/modules/dictData'
import { useDeptStore } from '@/store/modules/dept'
const DictStore = useDictStore()
const DeptStore = useDeptStore()
DictStore.setDict('pipe_material') //材质字典
DictStore.setDict('pipe_state') //状态字典
const DetailSchema = reactive<DescriptionsSchema[]>([
  {
    field: 'pipeLineName',
    label: '管线名称'
  },
  {
    field: 'pipeLineType',
    label: '管线类型',
    slots: {
      default: (data: any) => {
        return DictStore.$state.pipe_line_type?.map((item) => {
          if (item.dictValue == data.pipeLineType) {
            return item.dictLabel
          }
        })
      }
    }
  },
  {
    field: 'pipeLineNo',
    label: '管线编码'
  },
  {
    field: 'pipeDiameter',
    label: '管径'
  },
  {
    field: 'material',
    label: '材质',
    slots: {
      default: (data: any) => {
        return DictStore.$state.pipe_material?.map((item) => {
          if (item.dictValue == data.material) {
            return item.dictLabel
          }
        })
      }
    }
  },
  {
    field: 'dataSource',
    label: '数据来源'
  },
  {
    field: 'deptId',
    label: '责任部门',
    slots: {
      default: (data: any) => {
        if (data.deptId) {
          return DeptStore.getDeptName(data.deptId)[0]?.deptName
        }
      }
    }
  },
  {
    field: 'pressure',
    label: '压力'
  },
  {
    field: 'startDepth',
    label: '起点埋深'
  },
  {
    field: 'endDepth',
    label: '终点埋深'
  },

  {
    field: 'startPipePoint',
    label: '起始点号'
  },
  {
    field: 'endPipePoint',
    label: '终止点号'
  },
  {
    field: 'pipeState',
    label: '状态',
    slots: {
      default: (data: any) => {
        return DictStore.$state.pipe_state?.map((item) => {
          if (item.dictValue == data.pipeState) {
            return item.dictLabel
          }
        })
      }
    }
  },

  {
    field: 'startLon',
    label: '开始坐标',
    slots: {
      default: (data: any) => {
        return `（${data.startLon}，${data.startLat}）`
      }
    }
  },
  {
    field: 'endLon',
    label: '结束坐标',
    slots: {
      default: (data: any) => {
        return `（${data.endLon}，${data.endLat}）`
      }
    }
  }
])
defineProps({
  currentRow: {
    type: Object as PropType<any>,
    default: () => null
  }
})
</script>

<template>
  <Descriptions
    style="font-size: 12px !important"
    :schema="DetailSchema"
    :data="currentRow || {}"
  />
</template>
